<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../../css/aui.css">
    <link rel="stylesheet" type="text/css" href="../../css/aui-slide.css">
    <link rel="stylesheet" type="text/css" href="../../css/api.css">
    <script type="text/javascript" src="../../script/api.js"></script>
</head>

<body  >
    <header class="aui-bar aui-bar-nav aui-bar-pink" style="top:-0.1rem;background-color: #f7911b;height: 3rem;">
        <span class="aui-iconfont aui-icon-left aui-pull-left" onclick="api.closeWin()" style="font-size:1rem;"></span>
        <div class="aui-title">消息中心</div>
        <span style="float: right;margin-right: 1rem;font-size: 0.8rem;margin-top: 0.1rem;"></span>
    </header>
    <div class="aui-content aui-margin-b-15" style="border-radius:0;">
        <ul class="aui-list aui-media-list">
            <li class="aui-list-item aui-list-item-middle" onclick="openFanli()" id="fanli_tixing">
                <div class="aui-media-list-item-inner">
                    <div class="aui-list-item-media" style="width: 2rem;">
                        <i class="aui-iconfont aui-icon-comment" style="font-size:1rem;"></i>
                    </div>
                    <div class="aui-list-item-inner aui-list-item-arrow">
                        <div class="aui-list-item-text">
                            <div class="aui-list-item-title aui-font-size-16">返利提醒</div>
                            <div class="aui-list-item-right aui-hide">08:00</div>
                        </div>
                        <div class="aui-list-item-text aui-ellipsis-1" id="message_notice">
                        </div>
                    </div>
                </div>
            </li>
            <!-- <li class="aui-list-item aui-list-item-middle" onclick="openMyMessage()">
                <div class="aui-media-list-item-inner">
                    <div class="aui-list-item-media" style="width: 2rem;">
                        <i class="aui-iconfont aui-icon-comment aui-list-icon-md"></i>
                    </div>
                    <div class="aui-list-item-inner aui-list-item-arrow">
                        <div class="aui-list-item-text">
                            <div class="aui-list-item-title aui-font-size-14">我的消息</div>
                            <div class="aui-list-item-right aui-hide">08:00</div>
                        </div>
                        <div class="aui-list-item-text aui-ellipsis-1" id="message_news">
                        </div>
                    </div>
                </div>
            </li> -->
            <li class="aui-list-item aui-list-item-middle" onclick="openMessageNotify()" >
               
                <div class="aui-media-list-item-inner">
                    <div class="aui-list-item-media" style="width: 2rem;">
                        <i class="aui-iconfont aui-icon-comment aui-list-icon-md"  style="font-size:1rem;"></i>
                        
                    </div>
                    <div class="aui-list-item-inner aui-list-item-arrow">
                        <div class="aui-list-item-text">
                            <div class="aui-list-item-title aui-font-size-16">通知</div>
                            <div class="aui-list-item-right aui-hide">08:00</div>
                        </div>
                        <div class="aui-list-item-text aui-ellipsis-1" id="message_inform">
                        </div>
                    </div>
                </div>
            </li>
        </ul>
    </div>
</body>
<script type="text/javascript">
    apiready = function() {
        var message_notice = $api.byId('message_notice');
        var message_news = $api.byId('message_news');
        var message_inform = $api.byId('message_inform');
        /* 下拉刷新頁面 */
        api.setRefreshHeaderInfo({
            visible: true,
            // loadingImg: 'widget://image/refresh.png',
            bgColor: '#ccc',
            textColor: '#fff',
            textDown: '下拉刷新...',
            textUp: '松开刷新...',
            showTime: true
        }, function(ret, err) {
            window.location.reload();
            api.refreshHeaderLoadDone();
        });

        var body={
          token:$api.getStorage('token')
        };
        api.ajax({
            url: 'http://www.mk517.com/webApi/Messenger.php',
            method: 'post',
            dataType:'json',
            "headers":{"Content-Type":"application/json"},
            data: {
                body:body
            }
        }, function(ret, err) {
            if (ret) {
            //   alert(JSON.stringify(ret));
            
            if(ret.isnew==1){
                $api.byId('fanli_tixing').innerHTML += ' <div style="width: 0.5rem;height: 0.5rem;border-radius: 1rem;background-color: red;float: right;margin-top: -2rem;margin-right: 0.6rem;">'+
                   ' </div>'
            
        }else{

        }
               
                // message_notice.innerHTML=ret.message_notice;
                // message_news.innerHTML=ret.message_news;
                // message_inform.innerHTML=ret.message_inform;
            } else {
                // alert(JSON.stringify(err));
            }
        });
        window.openFanli = function() {
            api.openWin({
                name: 'fanli',
                url: 'fanli.html',
                rect: {
                    x: 0,
                    y: 0,
                    w: 'auto',
                    h: 'auto'
                },
                allowEdit:true
            });

          

        };
        window.openMyMessage = function() {
            api.openWin({
                name: 'myMessage',
                url: 'myMessage.html',
                rect: {
                    x: 0,
                    y: 0,
                    w: 'auto',
                    h: 'auto'
                },
                allowEdit:true
            });
        };
        window.openMessageNotify = function() {
            api.openWin({
                name: 'messageNotify',
                url: 'messageNotify.html',
                rect: {
                    x: 0,
                    y: 0,
                    w: 'auto',
                    h: 'auto'
                },
                allowEdit:true
            });
        };
    }
    // api.addEventListener({
    //     　　　　name: 'keyback'
    //     　　}, function(ret, err) {
    //     // 　　　　api.closeFrame({
    //     // 　　　　　　name: 'index'
    //     // 　　　　});
    //         api.historyBack({
    //             frameName: 'youquanmian' 
    //         }, function(ret, err) {
    //             if (!ret.status) {
    //                 api.closeFrame();
    //             }
    //         });
    //     　});
</script>

</html>
